//
//  PublishReportViewController.m
//  Love trial1。0
//
//  Created by giantumbrella on 15/5/29.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "PublishReportViewController.h"
#import "CommonMacro.h"
#import "StarView.h"
#import "TopPublishTraRepView.h"
#import "EditReportTraView.h"
#import "FinishReportViewController.h"
#import "PublishReoprtPopVC.h"

@interface PublishReportViewController ()<StarViewDelegate,UITextViewDelegate>
{
UITextView *myTextView;//评论输入框
int starCount;//星星数量
UIButton *submitTrailReportButton; //提交按钮
UILabel *sourceLab; //评价
UILabel *placeholder_lable;//评论holder
}

@property (nonatomic,strong) TopPublishTraRepView *topPublishTraRepView;
@property (nonatomic,strong) EditReportTraView *editReportTraView;
@property (nonatomic,strong) UIButton *submitReporTButton;
@property (nonatomic,strong) PublishReoprtPopVC *publishReportPopView;
@end

@implementation PublishReportViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.rightBarButtonItem = nil;
    self.title = @"发表试用报告";
      starCount = 3;
    //弹出视图
    self.publishReportPopView = [[PublishReoprtPopVC alloc] init];
    //创建视图
    [self createSubview];
}

#pragma mark 创建视图
- (void)createSubview
{
    //1.scrollView
//    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
//    [self.view addSubview:self.scrollView];
//    self.scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT*1.1);
    
    //头部
    self.topPublishTraRepView = [[TopPublishTraRepView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT*0.27)];
    [self.view addSubview:self.topPublishTraRepView];
//    self.topPublishTraRepView.backgroundColor = [UIColor blueColor];
    
    //正文部分
    self.editReportTraView = [[EditReportTraView alloc] initWithFrame:CGRectMake(7, self.topPublishTraRepView.frame.size.height+self.topPublishTraRepView.frame.origin.y+10, SCREEN_WIDTH-14, SCREEN_HEIGHT*0.53)];
    [self.view addSubview:self.editReportTraView];
    
    //提交试用报告
    self.submitReporTButton = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH*0.3, self.editReportTraView.frame.size.height+self.editReportTraView.frame.origin.y+7, SCREEN_WIDTH*0.4, 28)];
    [self.view addSubview:self.submitReporTButton];
//    [self.submitReporTButton setBackgroundImage:[UIImage imageNamed:@"提交试用报告"] forState:UIControlStateNormal];
    [self.submitReporTButton setTitle:@"提交试用报告" forState:UIControlStateNormal];
    [self.submitReporTButton setBackgroundColor:UIColorWithRGBA(245, 83, 126, 1)];
    self.submitReporTButton.layer.cornerRadius = 3;
    self.submitReporTButton.clipsToBounds = YES;
    [self.submitReporTButton addTarget:self action:@selector(publishClick) forControlEvents:UIControlEventTouchUpInside];

}

#pragma mark 提交试用报告 弹出视图
- (void)publishClick
{
    [self.publishReportPopView publishReportPopView];
}

//#pragma  mark 页面视图创建
//- (void)creareView
//{
//    UIView *scoreAndTitleView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH*1.0/32, SCREEN_HEIGHT*1.0/7, SCREEN_WIDTH*30/32, SCREEN_WIDTH*1.0/8)];
//    scoreAndTitleView.backgroundColor = [UIColor greenColor];
//    [self.view addSubview:scoreAndTitleView];
//
//    //1.星级评分功能
//    StarView *startView = [[StarView alloc]initWithFrame:CGRectMake(50,5, SCREEN_WIDTH*18/32, SCREEN_WIDTH*1.0/10)];
//    startView.backgroundColor = [UIColor redColor];
//    [scoreAndTitleView addSubview:startView];
//    startView.delegate =self;
//    UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 60, 30)];
//    nameLabel.text = @"评分:";
//    [scoreAndTitleView addSubview:nameLabel];
//    
//    sourceLab = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-80, 5,80, 30)];
//    sourceLab.text = @"好";
//    [scoreAndTitleView addSubview:sourceLab];
//    
//    //2.标题的来路
//    UIView *tilteView = [[UIView alloc] initWithFrame:CGRectMake(scoreAndTitleView.frame.origin.x, scoreAndTitleView.frame.origin.y+scoreAndTitleView.frame.size.height+10, scoreAndTitleView.frame.size.width, scoreAndTitleView.frame.size.height)];
//    tilteView.backgroundColor = [UIColor greenColor];
//    [self.view addSubview:tilteView];
//    
//    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(5, 5, 60, 30)];
//    titleLabel.text = @"标题:";
//    [tilteView addSubview:titleLabel];
//    
////    UITextField *titleTextField = [[UITextField alloc] initWithFrame:CGRectMake(titleLabel.frame.origin.x+titleLabel.frame.size.width+3, titleTextField.frame.origin.y, SCREEN_WIDTH-titleTextField.frame.size.width,titleTextField.frame.size.height)];
//    UITextField *titleTextField = [[UITextField alloc] initWithFrame:CGRectMake(60, 5, 200, 30)];
//    titleTextField.backgroundColor = [UIColor blueColor];
//    titleTextField.placeholder = @"此处输入标题";
//    [tilteView addSubview:titleTextField];
//    
//    //3.试用感受 文字编辑
//    UITextField *feelTextField = [[UITextField alloc] initWithFrame:CGRectMake(scoreAndTitleView.frame.origin.x, tilteView.frame.origin.y+tilteView.frame.size.height+5, scoreAndTitleView.frame.size.width, SCREEN_HEIGHT*4.0/8)];
//    feelTextField.backgroundColor = [UIColor greenColor];
//    feelTextField.placeholder = @"此处书写情感事件";
//    [self.view addSubview:feelTextField];
//    
//    //4.拍照功能
//    
//    //5.提叫试用报告
//   submitTrailReportButton = [[UIButton alloc] initWithFrame:CGRectMake(20, SCREEN_HEIGHT-60, SCREEN_WIDTH-40, 40)];
//    submitTrailReportButton.backgroundColor = [UIColor redColor];
//    [self.view addSubview:submitTrailReportButton];
//    [submitTrailReportButton addTarget:self action:@selector(submitReportDone) forControlEvents:UIControlEventTouchUpInside];
//}
//
//#pragma mark - StarViewDelegate
//- (void)starView:(StarView *)starView score:(int)score
//{
//    starCount = score;
//    switch (starCount) {
//        case 1:
//            sourceLab.text = @"差";
//            break;
//        case 2:
//            sourceLab.text = @"一般";
//            break;
//        default:
//            sourceLab.text = @"好";
//            break;
//    }
//    
//}
//
//#pragma mark 提交试用报告
//- (void)submitReportDone
//{
//    FinishReportViewController *finishReportView = [FinishReportViewController new];
//    UINavigationController *naviFinishReport = [[UINavigationController alloc] initWithRootViewController:finishReportView];
//    [self.navigationController presentViewController:naviFinishReport animated:YES completion:nil];
//}
//
//#pragma mark 键盘退出事件
//- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
//{
//    [self.view endEditing:YES];
//}

@end
